package com.ficus.road.maintain.core.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RoadDiseaseResult {
    Bbox bbox;
    RelBbox relBbox;
    float lumpiness;
    //宽度，单位mm
    Integer width;
    //长度，单位m
    float length;
    //面积，单位m^2
    float area;
    //角度
    float angle;
    //高差
    Integer heightDiff;
    //倒伏数量
    int fallDownNumber;
    //道路类型 ROAD_TYPE_UNKNOWN-未知; ROAD_TYPE_ASPHALT-柏油路 ROAD_TYPE_CEMENT-沥青路
    String roadType;
    Boolean needPushOut;
    //人头数
    Integer headCount;
    //舒适指数
    Float comfortRate;
    //场景  CITY 城市治理;ECONOMIC 经济治理;SOCIETY 社会治理
    String scene;
    //场景  SECURITY 安全  ORDER 有序 CLEAN 干净
    String classification;
    //缺陷打分
    Float score;
    //严重程度
    SeverityType severityType;
    //缺陷类型
    String diseaseType;
    //缺陷子类型
    String subType;

    // 病害类型
    String type;

    //病害id（用于前端的视频回放时将病害标注出来）
    String diseaseUid;

    HitStatusEnum status;

    public enum RoadDiseaseType {
        //裂缝
        PIC_CRACK_RESULT("PIC_CRACK_RESULT"),
        //裂缝
        PIC_CRACK("PIC_CRACK"),

        //破碎板
        BROKEN_BOARD("BROKEN_BOARD"),

        //板角断裂
        BOARD_CORNER_FRACTURE("BOARD_CORNER_FRACTURE"),

        //块状裂缝
        MASSIVE_CRACKS("MASSIVE_CRACKS"),

        //龟裂
        CRACKED("CRACKED"),

        //接缝料损坏
        DAMAGED_JOINT_MATERIAL("DAMAGED_JOINT_MATERIAL"),

        //边角剥落
        FLAKING_OFF_THE_CORNERS("FLAKING_OFF_THE_CORNERS"),

        //坑洼
        PIC_POTHOLES_RESULT("PIC_POTHOLES_RESULT"),

        //井盖
        PIC_MANHOLE_COVER_DISLOCATION_RESULT("PIC_MANHOLE_COVER_DISLOCATION_RESULT");

        private String value;

        RoadDiseaseType(String value) {
            this.value = value;
        }

        @JsonCreator
        public static RoadDiseaseType fromValue(String value) {
            for (RoadDiseaseType b : RoadDiseaseType.values()) {
                if (b.value.equals(value)) {
                    return b;
                }
            }
            throw new IllegalArgumentException("Unexpected value '" + value + "'");
        }

        @Override
        @JsonValue
        public String toString() {
            return String.valueOf(value);
        }

    }

    public enum PicCrackType {
        //裂缝
        PIC_CRACK("PIC_CRACK"),

        //破碎板
        BROKEN_BOARD("BROKEN_BOARD"),

        //板角断裂
        BOARD_CORNER_FRACTURE("BOARD_CORNER_FRACTURE"),

        //块状裂缝
        MASSIVE_CRACKS("MASSIVE_CRACKS"),

        //龟裂
        CRACKED("CRACKED"),

        //接缝料损坏
        DAMAGED_JOINT_MATERIAL("DAMAGED_JOINT_MATERIAL"),

        //边角剥落
        FLAKING_OFF_THE_CORNERS("FLAKING_OFF_THE_CORNERS");

        private String value;

        PicCrackType(String value) {
            this.value = value;
        }

        @JsonCreator
        public static PicCrackType fromValue(String value) {
            for (PicCrackType b : PicCrackType.values()) {
                if (b.value.equals(value)) {
                    return b;
                }
            }
            throw new IllegalArgumentException("Unexpected value '" + value + "'");
        }

        @Override
        @JsonValue
        public String toString() {
            return String.valueOf(value);
        }

    }

}
